/** <a href="http://www.cpupk.com/decompiler">Eclipse Class Decompiler</a> plugin, Copyright (c) 2017 Chen Chao. **/
package com.minierp.validator;

import com.minierp.model.MakeRequire;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;

public class MakeRequireValidator implements Validator {
	public boolean supports(Class clazz) {
		return MakeRequire.class.isAssignableFrom(clazz);
	}

	public void validate(Object obj, Errors errors) {
		MakeRequire form = (MakeRequire) obj;
		if (form.getRequireContent() != null
				&& !form.getRequireContent().trim().equals("")) {
			if (form.getRequireContent().length() > 100) {
				errors.rejectValue("requireContent", "", "『要求内容』不能多于100个字符");
			}
		} else {
			errors.rejectValue("requireContent", "", "请输入『要求内容』");
		}

	}
}